import java.util.concurrent.BlockingDeque;
import java.util.concurrent.LinkedBlockingDeque;

public class demo05 {
    //阻塞队列
    public static void main(String[] args) throws InterruptedException {
        BlockingDeque<String> queue=new LinkedBlockingDeque<>();
        //阻塞队列核心方法：1、put入队列 2、take出队列
        queue.put("hello1");
        queue.put("hello2");
        queue.put("hello3");
        queue.put("hello4");

        String result=null;
        result= queue.take();
        System.out.println(result);
        result= queue.take();
        System.out.println(result);
        result= queue.take();
        System.out.println(result);
        result= queue.take();
        System.out.println(result);
        result= queue.take();
        System.out.println(result);
    }
}




